package fr.afcepf.atod11.framework.forms;

import java.util.regex.Pattern;

import fr.afcepf.atod11.framework.forms.interfaces.IActionForm;

public class LoginForm implements IActionForm{
private int id;
	private String password;
	private String email;
	

	@Override
	public boolean validate() {

		boolean result = true;
		Pattern p = Pattern.compile("^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
		
		result &= p.matcher(getEmail()).matches();
		result &= !password.isEmpty();
		
		return result;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public String getEmail() {
		return email;
	}


	public void setPassword(String password) {
		this.password = password;
	}


	public String getPassword() {
		return password;
	}


	public void setId(int id) {
		this.id = id;
	}


	public int getId() {
		return id;
	}

}
